// extend the DataProxy to write
Ext.ux.DwrWriteProxy = function(dwrCall)
{
  Ext.ux.DwrWriteProxy.superclass.constructor.call(this);
  this.dwrCall = dwrCall;
};

Ext.extend(Ext.ux.DwrWriteProxy, Ext.data.DataProxy,
{
  update : function(params, callback, scope, arg)
  {
    if(this.fireEvent("beforeupdate", this, params) !== false)
    {
      var delegate = this.updateResponse.createDelegate(this, [callback, scope, arg], 1);
      var callParams = new Array();
      if(arg && arg.arg)                               { callParams = arg.arg.slice(); }
      else if (params.length)                          { callParams = params; }
      //else if (params.data && params.data.length == 1) { callParams.push(params.data[0]); }
      else                                             { callParams.push(params); }

      callParams.push(delegate);
      this.dwrCall.apply(this, callParams);
    }
    else { callback.call(scope||this, arg, false, null); }
  },

  updateResponse : function(o, callback, scope, arg)
  {
    delete this.activeRequest;
    // in observing the calling arguments, only scope is set to the data store itself
    // let's signal the success for now, WYU 122907
    this.fireEvent("update", this);
  }
});